/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jl.tools.stkeditor.generate;

import com.jl.tools.stkeditor.exception.DataNotMatchCodingScheamException;
import com.jl.util.HexUtil;
import java.util.List;

/**
 *
 * @author LuHongjun
 */
public final class AddNormalTag extends CodeDect {

    private String tag;

    public AddNormalTag(Code code, String tag) {
        this.code = code;
        this.tag = tag;
    }

    @Override
    public List<String> getCode() throws DataNotMatchCodingScheamException {
        List<String> l = code.getCode();
        int len = code.getLength();
        l.add(0, HexUtil.toHexXX(len));
        l.add(0, tag);
        return l;
    }

    @Override
    public int getLength() {
        return code.getLength() + 2;
    }
}
